package qldc.pm.tienan.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import qldc.pm.tienan.model.CongViecBanGiao;
import qldc.pm.tienan.model.CongViecBanGiaoModel;

import java.io.Serializable;

import java.sql.Types;

import java.util.HashMap;
import java.util.Map;

/**
 * The base model implementation for the CongViecBanGiao service. Represents a row in the &quot;TA_CongViecBanGiao&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link qldc.pm.tienan.model.CongViecBanGiaoModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link CongViecBanGiaoImpl}.
 * </p>
 *
 * @author Brian Wing Shun Chan
 * @see CongViecBanGiaoImpl
 * @see qldc.pm.tienan.model.CongViecBanGiao
 * @see qldc.pm.tienan.model.CongViecBanGiaoModel
 * @generated
 */
public class CongViecBanGiaoModelImpl extends BaseModelImpl<CongViecBanGiao>
    implements CongViecBanGiaoModel {
    /*
     * NOTE FOR DEVELOPERS:
     *
     * Never modify or reference this class directly. All methods that expect a cong viec ban giao model instance should use the {@link qldc.pm.tienan.model.CongViecBanGiao} interface instead.
     */
    public static final String TABLE_NAME = "TA_CongViecBanGiao";
    public static final Object[][] TABLE_COLUMNS = {
            { "congViecBanGiaoId", Types.BIGINT },
            { "bienBanBanGiaoHoSoId", Types.BIGINT },
            { "tenCongViec", Types.VARCHAR },
            { "tienDoThucHien", Types.VARCHAR },
            { "chuThich", Types.VARCHAR }
        };
    public static final String TABLE_SQL_CREATE = "create table TA_CongViecBanGiao (congViecBanGiaoId LONG not null primary key,bienBanBanGiaoHoSoId LONG,tenCongViec VARCHAR(75) null,tienDoThucHien VARCHAR(75) null,chuThich VARCHAR(75) null)";
    public static final String TABLE_SQL_DROP = "drop table TA_CongViecBanGiao";
    public static final String ORDER_BY_JPQL = " ORDER BY congViecBanGiao.congViecBanGiaoId DESC";
    public static final String ORDER_BY_SQL = " ORDER BY TA_CongViecBanGiao.congViecBanGiaoId DESC";
    public static final String DATA_SOURCE = "liferayDataSource";
    public static final String SESSION_FACTORY = "liferaySessionFactory";
    public static final String TX_MANAGER = "liferayTransactionManager";
    public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
                "value.object.entity.cache.enabled.qldc.pm.tienan.model.CongViecBanGiao"),
            true);
    public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
                "value.object.finder.cache.enabled.qldc.pm.tienan.model.CongViecBanGiao"),
            true);
    public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
                "value.object.column.bitmask.enabled.qldc.pm.tienan.model.CongViecBanGiao"),
            true);
    public static long BIENBANBANGIAOHOSOID_COLUMN_BITMASK = 1L;
    public static long CONGVIECBANGIAOID_COLUMN_BITMASK = 2L;
    public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
                "lock.expiration.time.qldc.pm.tienan.model.CongViecBanGiao"));
    private static ClassLoader _classLoader = CongViecBanGiao.class.getClassLoader();
    private static Class<?>[] _escapedModelInterfaces = new Class[] {
            CongViecBanGiao.class
        };
    private long _congViecBanGiaoId;
    private long _bienBanBanGiaoHoSoId;
    private long _originalBienBanBanGiaoHoSoId;
    private boolean _setOriginalBienBanBanGiaoHoSoId;
    private String _tenCongViec;
    private String _tienDoThucHien;
    private String _chuThich;
    private long _columnBitmask;
    private CongViecBanGiao _escapedModel;

    public CongViecBanGiaoModelImpl() {
    }

    @Override
    public long getPrimaryKey() {
        return _congViecBanGiaoId;
    }

    @Override
    public void setPrimaryKey(long primaryKey) {
        setCongViecBanGiaoId(primaryKey);
    }

    @Override
    public Serializable getPrimaryKeyObj() {
        return _congViecBanGiaoId;
    }

    @Override
    public void setPrimaryKeyObj(Serializable primaryKeyObj) {
        setPrimaryKey(((Long) primaryKeyObj).longValue());
    }

    @Override
    public Class<?> getModelClass() {
        return CongViecBanGiao.class;
    }

    @Override
    public String getModelClassName() {
        return CongViecBanGiao.class.getName();
    }

    @Override
    public Map<String, Object> getModelAttributes() {
        Map<String, Object> attributes = new HashMap<String, Object>();

        attributes.put("congViecBanGiaoId", getCongViecBanGiaoId());
        attributes.put("bienBanBanGiaoHoSoId", getBienBanBanGiaoHoSoId());
        attributes.put("tenCongViec", getTenCongViec());
        attributes.put("tienDoThucHien", getTienDoThucHien());
        attributes.put("chuThich", getChuThich());

        return attributes;
    }

    @Override
    public void setModelAttributes(Map<String, Object> attributes) {
        Long congViecBanGiaoId = (Long) attributes.get("congViecBanGiaoId");

        if (congViecBanGiaoId != null) {
            setCongViecBanGiaoId(congViecBanGiaoId);
        }

        Long bienBanBanGiaoHoSoId = (Long) attributes.get(
                "bienBanBanGiaoHoSoId");

        if (bienBanBanGiaoHoSoId != null) {
            setBienBanBanGiaoHoSoId(bienBanBanGiaoHoSoId);
        }

        String tenCongViec = (String) attributes.get("tenCongViec");

        if (tenCongViec != null) {
            setTenCongViec(tenCongViec);
        }

        String tienDoThucHien = (String) attributes.get("tienDoThucHien");

        if (tienDoThucHien != null) {
            setTienDoThucHien(tienDoThucHien);
        }

        String chuThich = (String) attributes.get("chuThich");

        if (chuThich != null) {
            setChuThich(chuThich);
        }
    }

    @Override
    public long getCongViecBanGiaoId() {
        return _congViecBanGiaoId;
    }

    @Override
    public void setCongViecBanGiaoId(long congViecBanGiaoId) {
        _columnBitmask = -1L;

        _congViecBanGiaoId = congViecBanGiaoId;
    }

    @Override
    public long getBienBanBanGiaoHoSoId() {
        return _bienBanBanGiaoHoSoId;
    }

    @Override
    public void setBienBanBanGiaoHoSoId(long bienBanBanGiaoHoSoId) {
        _columnBitmask |= BIENBANBANGIAOHOSOID_COLUMN_BITMASK;

        if (!_setOriginalBienBanBanGiaoHoSoId) {
            _setOriginalBienBanBanGiaoHoSoId = true;

            _originalBienBanBanGiaoHoSoId = _bienBanBanGiaoHoSoId;
        }

        _bienBanBanGiaoHoSoId = bienBanBanGiaoHoSoId;
    }

    public long getOriginalBienBanBanGiaoHoSoId() {
        return _originalBienBanBanGiaoHoSoId;
    }

    @Override
    public String getTenCongViec() {
        if (_tenCongViec == null) {
            return StringPool.BLANK;
        } else {
            return _tenCongViec;
        }
    }

    @Override
    public void setTenCongViec(String tenCongViec) {
        _tenCongViec = tenCongViec;
    }

    @Override
    public String getTienDoThucHien() {
        if (_tienDoThucHien == null) {
            return StringPool.BLANK;
        } else {
            return _tienDoThucHien;
        }
    }

    @Override
    public void setTienDoThucHien(String tienDoThucHien) {
        _tienDoThucHien = tienDoThucHien;
    }

    @Override
    public String getChuThich() {
        if (_chuThich == null) {
            return StringPool.BLANK;
        } else {
            return _chuThich;
        }
    }

    @Override
    public void setChuThich(String chuThich) {
        _chuThich = chuThich;
    }

    public long getColumnBitmask() {
        return _columnBitmask;
    }

    @Override
    public ExpandoBridge getExpandoBridge() {
        return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
            CongViecBanGiao.class.getName(), getPrimaryKey());
    }

    @Override
    public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
        ExpandoBridge expandoBridge = getExpandoBridge();

        expandoBridge.setAttributes(serviceContext);
    }

    @Override
    public CongViecBanGiao toEscapedModel() {
        if (_escapedModel == null) {
            _escapedModel = (CongViecBanGiao) ProxyUtil.newProxyInstance(_classLoader,
                    _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
        }

        return _escapedModel;
    }

    @Override
    public Object clone() {
        CongViecBanGiaoImpl congViecBanGiaoImpl = new CongViecBanGiaoImpl();

        congViecBanGiaoImpl.setCongViecBanGiaoId(getCongViecBanGiaoId());
        congViecBanGiaoImpl.setBienBanBanGiaoHoSoId(getBienBanBanGiaoHoSoId());
        congViecBanGiaoImpl.setTenCongViec(getTenCongViec());
        congViecBanGiaoImpl.setTienDoThucHien(getTienDoThucHien());
        congViecBanGiaoImpl.setChuThich(getChuThich());

        congViecBanGiaoImpl.resetOriginalValues();

        return congViecBanGiaoImpl;
    }

    @Override
    public int compareTo(CongViecBanGiao congViecBanGiao) {
        int value = 0;

        if (getCongViecBanGiaoId() < congViecBanGiao.getCongViecBanGiaoId()) {
            value = -1;
        } else if (getCongViecBanGiaoId() > congViecBanGiao.getCongViecBanGiaoId()) {
            value = 1;
        } else {
            value = 0;
        }

        value = value * -1;

        if (value != 0) {
            return value;
        }

        return 0;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }

        if (!(obj instanceof CongViecBanGiao)) {
            return false;
        }

        CongViecBanGiao congViecBanGiao = (CongViecBanGiao) obj;

        long primaryKey = congViecBanGiao.getPrimaryKey();

        if (getPrimaryKey() == primaryKey) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public int hashCode() {
        return (int) getPrimaryKey();
    }

    @Override
    public void resetOriginalValues() {
        CongViecBanGiaoModelImpl congViecBanGiaoModelImpl = this;

        congViecBanGiaoModelImpl._originalBienBanBanGiaoHoSoId = congViecBanGiaoModelImpl._bienBanBanGiaoHoSoId;

        congViecBanGiaoModelImpl._setOriginalBienBanBanGiaoHoSoId = false;

        congViecBanGiaoModelImpl._columnBitmask = 0;
    }

    @Override
    public CacheModel<CongViecBanGiao> toCacheModel() {
        CongViecBanGiaoCacheModel congViecBanGiaoCacheModel = new CongViecBanGiaoCacheModel();

        congViecBanGiaoCacheModel.congViecBanGiaoId = getCongViecBanGiaoId();

        congViecBanGiaoCacheModel.bienBanBanGiaoHoSoId = getBienBanBanGiaoHoSoId();

        congViecBanGiaoCacheModel.tenCongViec = getTenCongViec();

        String tenCongViec = congViecBanGiaoCacheModel.tenCongViec;

        if ((tenCongViec != null) && (tenCongViec.length() == 0)) {
            congViecBanGiaoCacheModel.tenCongViec = null;
        }

        congViecBanGiaoCacheModel.tienDoThucHien = getTienDoThucHien();

        String tienDoThucHien = congViecBanGiaoCacheModel.tienDoThucHien;

        if ((tienDoThucHien != null) && (tienDoThucHien.length() == 0)) {
            congViecBanGiaoCacheModel.tienDoThucHien = null;
        }

        congViecBanGiaoCacheModel.chuThich = getChuThich();

        String chuThich = congViecBanGiaoCacheModel.chuThich;

        if ((chuThich != null) && (chuThich.length() == 0)) {
            congViecBanGiaoCacheModel.chuThich = null;
        }

        return congViecBanGiaoCacheModel;
    }

    @Override
    public String toString() {
        StringBundler sb = new StringBundler(11);

        sb.append("{congViecBanGiaoId=");
        sb.append(getCongViecBanGiaoId());
        sb.append(", bienBanBanGiaoHoSoId=");
        sb.append(getBienBanBanGiaoHoSoId());
        sb.append(", tenCongViec=");
        sb.append(getTenCongViec());
        sb.append(", tienDoThucHien=");
        sb.append(getTienDoThucHien());
        sb.append(", chuThich=");
        sb.append(getChuThich());
        sb.append("}");

        return sb.toString();
    }

    @Override
    public String toXmlString() {
        StringBundler sb = new StringBundler(19);

        sb.append("<model><model-name>");
        sb.append("qldc.pm.tienan.model.CongViecBanGiao");
        sb.append("</model-name>");

        sb.append(
            "<column><column-name>congViecBanGiaoId</column-name><column-value><![CDATA[");
        sb.append(getCongViecBanGiaoId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>bienBanBanGiaoHoSoId</column-name><column-value><![CDATA[");
        sb.append(getBienBanBanGiaoHoSoId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>tenCongViec</column-name><column-value><![CDATA[");
        sb.append(getTenCongViec());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>tienDoThucHien</column-name><column-value><![CDATA[");
        sb.append(getTienDoThucHien());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>chuThich</column-name><column-value><![CDATA[");
        sb.append(getChuThich());
        sb.append("]]></column-value></column>");

        sb.append("</model>");

        return sb.toString();
    }
}
